home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Utils Divers 1 / Horo Shareware / Horo / Horo.rsrc / TEXT_1563_T3. Miscellaneous.txt < prev    next >
Text File  |  1996-03-01  |  6KB  |  41 lines

  1. Miscellaneous Features & Tips
  2.  
  3. Resources
  4.   The following on-line help-related resources can be removed from finished applications that do not support ViewIt window editing:  TEXT/styl 1561-1566, MENU 1551, FCTL 1551, and FWND 1551 (this window).
  5.  
  6. Search Parameters
  7.   The default settings in TextCt's "Search" dialog are saved in STR# 1552.  The first string in this string list consists of a single character that defines a set of bit flags that you can modify (using ResEdit or directly from within your program) to change the dialog's default check box settings:
  8.   bit #1 = show advanced features
  9.   bit #2 = support use of "#" in Find string
  10.   bit #3 = support use of "#" in Replace string
  11.   bit #4 = Entire Word
  12.   bit #5 = Wrap Around
  13.   bit #6 = Search Columns
  14.   bit #7 = Ignore Case
  15.   bit #8 = use grep
  16. The fourth and fifth strings in STR# 1552 define the ASCII values to use in place of the "#" character in the Find and Replace strings.  The sixth and seventh strings in STR# 1552 define the left and right column bounds when using the "Search Columns" option.  For example, to have the Search dialog open with advanced settings shown (1), "Entire Word" checked (8), "Wrap Around" checked (16), and "Ignore Case" checked (64),  the first string in STR# 1552 should be set equal to character "Y" = ASCII 89.
  17.  
  18. Dirty Editors
  19.   An editor becomes "dirty" when the text in the editor is changed by the user.  Whether an editor is dirty or not can be determined by examining the high bit of the tcFlags variable in the tcRec record that is associated with each editor (see the "tcRec Record" topic for information about accessing values in tcRecs - tcFlags less than zero also indicates that the high bit is set and the editor is dirty).  This bit can also be set or cleared by your program using the toolbox calls "BitSet" and "BitClr" to change the dirty status of the editor.
  20.  
  21. File Connections
  22.   You can determine whether a disk file is connected to an editor by examining the tcRec variable tcVRef (see the "tcRec Record" topic for info about accessing values in tcRecs).  If tcVRef Γëá 0, then a file is connected, and the name of this file can be found in the control title (= cTitle after calling GetCtl).
  23.   The connection between a file and a TextCt control can be broken without disturbing the existing text in the editor by calling OpnCTxt or SavCTxt with an empty string in uName.  This might be useful, for example, if the editor was used to display help text from a file, but you did not want the editor to appear to be connected to any disk file.
  24.  
  25. Complex Documents
  26.   In some cases you may wish to use TextCt to display one or more text blocks from a complex document that's opened and saved without TextCt's help since TextCt only supports simple TEXT-type documents.  To replace all of TextCt's built-in file handling with your own code:
  27.  1) Make all file-related items (Open, Save, Save As, etc.) program-type menu items and support these directly with program code.
  28.  2) Add 256 to the VarCode to disable TextCt's window title handling, and manage the title with program code.
  29.  3) Uncheck the control's "Save" message so that TextCt does not prompt the user to save text when quitting, and implement any such prompting with program code.
  30.  
  31. Read-Only Alert
  32.   When working with read-only editors (8 was added to the VarCode), TextCt displays a simple error alert if the user attempts to type in the editor.  If you would prefer to have a single beep occur in place of this alert, set string #11 in STR# 1551 to an empty string.  Alternatively, if you prefer a different error string to be shown, then change string #11 in STR# 1551.  (When modifying FaceWare resources, edit a copy of the resource in your program's res file rather than an original in the FaceWare file.)
  33.  
  34. Converting Old Code
  35.   Many old programs being converted for use on the Mac were written to use a minimally interactive approach based on a series of questions (prompts) output by the program, and answers (responses) entered by the user (the "Q&A" approach).  Due to the "modeless" nature of the Mac, where many different options are available to the user at the same time, converting such programs can be a major headache.  A few suggestions are offered based on our experiences with other programmers:
  36. ΓÇó Modal Approach.  Rather than changing the old Q&A code, just isolate its use within the context of a mode initiated by the user.  For example, a program menu item could be used to bring a special window forward in which the Q&A code is executed.  While this window was at the front, the user would be in the Q&A mode, and no other options would be available.
  37. ΓÇó File Approach.  Force the user to set up input via text files that can be edited with a TextCt text editor.
  38. ΓÇó Selection Approach.  Force the user to set up input via a block of selected text in a TextCt editor. As with files, the entire block of text can be read at once and processed.
  39. ΓÇó Dialog Approach.  Replace the old Q&A code with alert- or dialog-based code.  This is the most Mac-like approach, but can require quite a bit of work.
  40. ΓÇó Modeless Approach.  Modify the old Q&A code to support the interactive type of I/O discussed in the topic "Text I/O".  The trick in this case is to provide support for the user's choice of other options while in the Q&A mode.  This usually involves isolating the program event loop in a separate routine that can be called between questions.  The loop only returns control to the Q&A code when it determines that an answer has been entered.  The Q&A code then processes the response, prompts the user for more input, and returns control to the loop until the next response is entered.
  41. ΓÇó FRWE Approach.  If using Absoft's MacFortran II or Language Systems Fortran, we provide an alternative "FaceWare Runtime Window Environment" or FRWE that can be used in place of their default window.  The advantage of using FRWE is that it automatically redirects standard I/O to a TextCt editor, thereby giving you all the power of ViewIt and TextCt without requiring changes to existing Fortran code.  See the FRWE folder for further info.